/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.dolphinscheduler.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.dolphinscheduler.api.service.InterfaceService;
import org.apache.dolphinscheduler.dao.dto.ZabbixDataDto;
import org.apache.dolphinscheduler.dao.entity.Interface;
import org.apache.dolphinscheduler.dao.mapper.InterfaceMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * alert group service impl
 */
@Service
public class InterfaceServiceImpl extends BaseServiceImpl implements InterfaceService {

    private Logger logger = LoggerFactory.getLogger(InterfaceServiceImpl.class);

    @Autowired
    private InterfaceMapper interfaceMapper;


    @Override
    public List<Interface> queryInterface(List<String> ipList) {
        return interfaceMapper.selectList(new QueryWrapper<Interface>()
                .lambda().in(Interface::getIp, ipList));
    }

    @Override
    public List<ZabbixDataDto> queryZabbixData(List<String> ipList) {
        return interfaceMapper.queryZabbixData(ipList);
    }
}
